package com.vivz.baby.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.vivz.baby.domain.User;
import com.vivz.baby.repository.UserRepository;

@Component
public class UserDAO {

    @Autowired
    private UserRepository userRepository;

    public <S extends User> S save(final S user) {
	return userRepository.save(user);
    }

    public void delete(final User user) {
	userRepository.delete(user);
    }

    public User findOne(final Long id) {
	return userRepository.findOne(id);
    }

    public boolean exists(final Long id) {
	return userRepository.exists(id);
    }

    public Iterable<User> findAll() {
	return userRepository.findAll();
    }

    public Iterable<User> findAll(final Iterable<Long> ids) {
	return userRepository.findAll(ids);
    }

    public long count() {
	return userRepository.count();
    }

    public void delete(final Long id) {
	userRepository.delete(id);
    }

    public void delete(final Iterable<? extends User> entities) {
	userRepository.delete(entities);
    }

    public void deleteAll() {
	userRepository.deleteAll();
    }

}
